let Controller = {
	mounted() {
		this.initData();
	},
	activated() {
		this.initData();
		this.requestDetail();
	},
	methods: {
		initData() {
			const param = this.$route.query;
			this.Model.queryData = _.cloneDeep(param);
		},
		requestDetail() {
			const barCode = this.Model.queryData.barCode;
			if (barCode) this.$ajax
				.get(`${api.sale}/saleGoodsInfo/getGoodsInfoByBarCode/${barCode}`)
				.then(res => {
					const data = res.data;
					if (data.status == 200) {
						const result = data.result;
						this.Model.tableData = [result]
					} else {
						this.$message.error(data.msg)
					}
				})
				.catch(error => {
					this.$message.error('请求错误');
				});
		},
		onTableSelectionChange(val) {
			this.Model.exportTableSelectList = val;
			console.log(this.Model.exportTableSelectList);
		},
		toggleTableDetail(val) {
			const obj = this.Model[val];
			if (obj.flag === true) {
				this.Model[val].src = require('@/assets/img/icon_collapse.png');
				this.Model[val].flag = false;
			} else {
				this.Model[val].src = require('@/assets/img/icon_unfold.png');
				this.Model[val].flag = true;
			}
		},
	}
}
export default Controller;
